package com.iuie.ns.system.vo.resource;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.iuie.ns.frame.utils.beans.TreeItem;
import com.iuie.ns.system.vo.role.SysRoleVO;

@Table(name = "SYS_RESOURCE")
@Entity
public class SysResourceVO extends TreeItem{

	// uuid通过java生成
	@Id
	@Column(name="res_id",length=32)
	private String resId; // 资源ID
	
	@Column(name="res_name")
	private String resName; // 资源名称
	
	@Column(name="res_desc")
	private String resDesc; // 资源描述
	
	@Column(name="res_type")
	private String resType; // 资源类型
	
	@Column(name="res_pid", length=32)
	private String resPid; // 父资源ID
	
	@Column(name="res_path")
	private String resPath; // 资源路径
	
	private Integer weight; // 权重
	
	private Integer enabled; // 启用状态

	@Column(name="res_ext1")
	private String resExt1; // 额外描述1
	
	@Column(name="res_ext2")
	private String resExt2; // 额外描述2
	
	@Column(name="res_ext3")
	private String resExt3; // 额外描述3
	
	@ManyToMany(mappedBy="resources")
	private Set<SysRoleVO> roles = new HashSet<>();

	/**
	 * @return the resId
	 */
	public String getResId() {
		return resId;
	}

	/**
	 * @param resId the resId to set
	 */
	public void setResId(String resId) {
		this.resId = resId;
	}

	/**
	 * @return the resName
	 */
	public String getResName() {
		return resName;
	}

	/**
	 * @param resName the resName to set
	 */
	public void setResName(String resName) {
		this.resName = resName;
	}

	/**
	 * @return the resDesc
	 */
	public String getResDesc() {
		return resDesc;
	}

	/**
	 * @param resDesc the resDesc to set
	 */
	public void setResDesc(String resDesc) {
		this.resDesc = resDesc;
	}

	/**
	 * @return the resType
	 */
	public String getResType() {
		return resType;
	}

	/**
	 * @param resType the resType to set
	 */
	public void setResType(String resType) {
		this.resType = resType;
	}

	/**
	 * @return the resPid
	 */
	public String getResPid() {
		return resPid;
	}

	/**
	 * @param resPid the resPid to set
	 */
	public void setResPid(String resPid) {
		this.resPid = resPid;
	}

	/**
	 * @return the resPath
	 */
	public String getResPath() {
		return resPath;
	}

	/**
	 * @param resPath the resPath to set
	 */
	public void setResPath(String resPath) {
		this.resPath = resPath;
	}

	/**
	 * @return the weight
	 */
	public Integer getWeight() {
		return weight;
	}

	/**
	 * @param weight the weight to set
	 */
	public void setWeight(Integer weight) {
		this.weight = weight;
	}

	/**
	 * @return the enabled
	 */
	public Integer getEnabled() {
		return enabled;
	}

	/**
	 * @param enabled the enabled to set
	 */
	public void setEnabled(Integer enabled) {
		this.enabled = enabled;
	}

	/**
	 * @return the resExt1
	 */
	public String getResExt1() {
		return resExt1;
	}

	/**
	 * @param resExt1 the resExt1 to set
	 */
	public void setResExt1(String resExt1) {
		this.resExt1 = resExt1;
	}

	/**
	 * @return the resExt2
	 */
	public String getResExt2() {
		return resExt2;
	}

	/**
	 * @param resExt2 the resExt2 to set
	 */
	public void setResExt2(String resExt2) {
		this.resExt2 = resExt2;
	}

	/**
	 * @return the resExt3
	 */
	public String getResExt3() {
		return resExt3;
	}

	/**
	 * @param resExt3 the resExt3 to set
	 */
	public void setResExt3(String resExt3) {
		this.resExt3 = resExt3;
	}

    @Override
    public String toString() {
        return "SysResourceVO [resId=" + resId + ", resName=" + resName + ", resDesc=" + resDesc + ", resType=" + resType + ", resPid=" + resPid + ", resPath=" + resPath
                + ", weight=" + weight + ", enabled=" + enabled + ", resExt1=" + resExt1 + ", resExt2=" + resExt2 + ", resExt3=" + resExt3 + "]";
    }
    @Override
    public String getId() {
        return this.resId;
    }

    @Override
    public String getPid() {
        return this.resPid;
    }

}
